﻿@model SGCC.Models.CronogramaModel
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Cronograma</h2>


<table class="tabela-cadastros">

</table>

<br /><br /><br />

@Html.ActionLink("Adicionar Obra","AdicionarObra","Obra", new { @class = "icon-add" })
    
    <table class="mws-table base-datatable">
        <thead>
            <tr>
                <th>Etapa</th>
                <th>Início</th>
                <th>Final</th>
                <th>Porcentagem</th>
                <th colspan="3">Ações</th>

            </tr>
        </thead>
        <tbody>
            @foreach (SGCC.Models.CronogramaModel o in ViewBag.resultado)
            {
                <tr>
                    <td class="column-actions">@o.Descricao </td>
                    <td class="column-actions">@o.DataIni</td>
                    <td class="column-actions">@o.DataFinal</td>
                    <td class="column-actions">@o.Porcentagem</td>
                    <td>@Html.ActionLink("Editar", "Editar", new { id = o.Id }, new { @class = "icon-edit" })</td>
                    <td>@Html.ActionLink("Excluir", "Excluir", new { id = o.Id }, new { @class = "icon-delete", onclick = "return confirm('Deseja desativar esta obra?');" } )</td>
                    <td>@Html.ActionLink("Tarefa", "Index", "Tarefa", new { etapa = o.Id }, new { @class = "icon-calendar" } )</td>
                </tr>    
            }
        </tbody>
    </table>

<div id="tarefas" title="Gerenciamento das Tarefas da Etapa">

</div>

<script>
    $('a[href*="Tarefa"]').on('click', function (e) {
        $.get(this.href, function (data) {
            $("#tarefas").html(data);
            $("#tarefas").dialog({width:700});
        });
        return false;
    });
</script>